<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri ="http://shiro.apache.org/tags" prefix="shiro"%>
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ROLE</title>

<link rel="stylesheet" type="text/css"
	href="easyui/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
<script type="text/javascript" src="easyui/jquery.min.js"></script>
<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="myjs/path.js"></script>
<script type="text/javascript" src='myjs/role.js'></script>
<script src="js/yangshi.js"></script>



</head>
<body class="easyui-layout">
	<shiro:lacksPermission name="role:look">没有查询此模块权限。。。</shiro:lacksPermission>
	<shiro:hasPermission name="role:look">
		<div data-options="region:'center',split:true" title="角色管理"
			style="width: 100px;">
			<table id='dg1' class="easyui-datagrid"
				style="width: 100%; height: 750px"
				data-options="rownumbers:true,singleSelect:true,method:'get',toolbar:'#tb',fit:true">
				<thead>
					<tr>
						<th data-options="field:'id',width:80,align:'center'" hidden="true">ID</th>
						<th data-options="field:'rolename',width:100,align:'center'">标识符</th>
						<th data-options="field:'note',width:120,align:'center'">角色名称</th>
						<th data-options="field:'status',width:120,align:'center'" hidden="true">类型</th>
					</tr>
				</thead>
		    </table>
			<div id="tb" style="padding: 5px; height: auto">
				<div style="margin-bottom: 5px">
					<shiro:hasPermission name="role:create">
					<a id='xinzeng' href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="openWin()">新增角色</a>
					</shiro:hasPermission>
					<shiro:hasPermission name="role:update">
				    <a id='xiu' href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="xopenWin()">修改角色</a>
					</shiro:hasPermission>
					<shiro:hasPermission name="role:del">
				    <a id='del' href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="del()">删除角色</a>
					</shiro:hasPermission>
				</div>
			</div>


	<!--新增款型=======================================================================================================-->
	<div style="margin: 20px 0;"></div>
	<div id="w" class="easyui-window" title="新增角色"
				data-options="modal:true,closed:true,iconCls:'icon-save',maximizable:false,minimizable:false,collapsible:false,closable: false"
				style="width: 604 px; height: 395px;" id="tan">
	   <div class="easyui-layout" style="width: 590px; height: 100%;">
					<div data-options="region:'east',split:true" title="权限信息"
						style="width: 250px;">
						<div style="margin: 0px 0;">
						</div>
						<div class="easyui-panel" style="padding: 5px">
							<ul id="tt" class="easyui-tree"
								data-options="url:'/erp/permission.do',method:'get',animate:true,checkbox:true"
								style="height: auto; clear: both;"></ul>
						</div>
					</div>

					<div data-options="region:'center',iconCls:'icon-ok',fit:true"
						title="角色信息" style="width: 150px;">


						<table cellpadding="4" width="300px height: 300px;">
						<tr>
                           <td>标识符:</td>
						   <td>
						   <input id='role' class="easyui-validatebox textbox"
									type="text" name="name" data-options="" onblur="biaoshi()">
						   <span id='role1' style="color: red;"> *</span>
						   </td>
						</tr>
						<tr>
						   <td>角色名称:</td>
						   <td>
						   <input id='rolename' class="easyui-validatebox textbox"
									type="text" name="name" data-options="" onblur="name1()">
									<span id='rolename1' style="color: red;"> *</span>
						   </td>
                        </tr>
                        <tr>
						   <td>角色类型:</td>
						   <td>
						  <input id='leixing' class="easyui-combobox" data-options="
	                       	valueField: 'status',
		                    textField: 'value',
		                    panelHeight:'auto',
		                    data: [{
			                     status: '-1',
			                     value: '总厂'
		                          },{
			                     status: '0',
			                     value: '零售店'
		                        },{
			                    status: '1',
			                    value: '省代'
		                        }]" 
		                        editable="false"/>
		                        <span id='leixing1' style="color: red;"> *</span>
						   </td>
                        </tr>
                        
					</table>
						<div id='msgq'
							style="margin-top: 200px; margin-left: 240px; color: red;"></div>
					</div>
					<div data-options="region:'south',split:true,"
						style="height: 40px;">
						<div style="float: right;">
							<button id="save" onclick="addRole()" 
								class="easyui-linkbutton" data-options="iconCls:'icon-save'">保存</button>
							<button id="xno" onclick="closeWins()" 
								class="easyui-linkbutton" data-options="iconCls:'icon-no'">取消</button>
						</div>
					</div>
				</div>

				<style scoped="scoped">
.textbox {
	height: 20px;
	margin: 0;
	padding: 0 2px;
	box-sizing: content-box;
}
</style>
			</div>
		</div>

<!--修改权限================================================================================================================-->
	<div style="margin: 20px 0;"></div>
		<div id="xw" class="easyui-window" title="修改角色"
			data-options="modal:true,closed:true,iconCls:'icon-save',maximizable:false,minimizable:false,closable: false,collapsible:false"
			style="width: 604px; height: 395px;" id="tan">

			<div class="easyui-layout" style="width: 590px; height: 100%;">
			<div data-options="region:'east',split:true" title="权限信息"
					style="width: 250px;">
					<div style="margin: 0px 0;">	
					</div>
					<div class="easyui-panel" style="padding: 5px">
						<ul id="tt2" class="easyui-tree"
							data-options="url:'/erp/permission.do',method:'get',animate:true,checkbox:true"
							style="height: auto; clear: both;"></ul>
					</div>

				</div>

				<div data-options="region:'center',iconCls:'icon-ok',fit:true"
					title="角色信息" style="width: 150px;">
					<table cellpadding="4" width="300px height: 300px;">
					  <tr>
						 <td>标识码:</td>
						 <td><input id='xrole1' class="easyui-validatebox textbox"
								type="text" onblur="xbiaoshi()"> 
								<span id='xrole2' style="color: red;"> *</span>
						 </td>
					  </tr>
					  <tr>
							<td>角色名称:</td>
							<td><input id='xrolename1'
								class="easyui-validatebox textbox" type="text" onblur="xname1()"><span
								id='rolename2' style="color: red;"> *</span></td>
					  </tr>
					   <tr>
						   <td>角色类型:</td>
						   <td>
						  <input id='xleixing' class="easyui-combobox" data-options="
	                       	valueField: 'status',
		                    textField: 'value',
		                    panelHeight:'auto',
		                    data: [{
			                     status: '-1',
			                     value: '总厂'
		                          },{
			                     status: '0',
			                     value: '零售店'
		                        },{
			                    status: '1',
			                    value: '省代'
		                        }]" 
		                         editable="false"/>
		                        <span id='xleixing1' style="color: red;"> *</span>
						   </td>
                        </tr>
				</table>
			<div id='msgq1'
						style="margin-top: 200px; margin-left: 240px; color: red;"></div>
			</div>
			<div data-options="region:'south',split:true," style="height: 40px;">
					<div style="float: right;">
						<button id="xsave" onclick="xaddRole()" 
							class="easyui-linkbutton" data-options="iconCls:'icon-save'">保存</button>
						<button id="xno" onclick="xcloseWins()" 
							class="easyui-linkbutton" data-options="iconCls:'icon-no'">取消</button>

					</div>
			</div>
			</div>

<style scoped="scoped">
.textbox {
	height: 20px;
	margin: 0;
	padding: 0 2px;
	box-sizing: content-box;
}
</style>
</div>

		<div data-options="region:'east',split:true" title="权限菜单"
			style="width: 300px;">

			<div class="easyui-panel" style="padding: 5px">
				<ul id="t2" class="easyui-tree"
					data-options="animate:true,checkbox:true"></ul>
			</div>
			<script type="text/javascript">
				function getChecked() {
					var nodes = $('#t2').tree('getChecked');
					var s = '';
					for (var i = 0; i < nodes.length; i++) {

						if (s != '')
							s += ',';
						s += nodes[i].id;
					}

				}
			</script>

		</div>
		<input id='jgid' type="hidden"
			value="<%=request.getParameter("jgid")%>">
		<input id='username' type="hidden"
			value="<%=request.getParameter("username")%>">
		<input id='userid' type="hidden"
			value="<%=request.getParameter("userid")%>">
		<input id='index11' type="hidden"
			value="<%=request.getParameter("index")%>">
	</shiro:hasPermission>


</body>
</html>